<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<link rel="stylesheet" type="text/css" href="../../avisynth.css">
   <title>ImageReader / ImageSource Filter</title>
<!--
Automatically generated, don't change:
$Id: imagesource.htm,v 1.16 2012/04/15 14:12:41 wilbertd Exp $
-->
</head>
<body>
<h2><a NAME="ImageSource"></a>ImageReader / ImageSource / ImageSourceAnim
</h2>
<p>
  <code>ImageReader </code>(<var>string &quot;file&quot;, int &quot;start&quot;,
  int &quot;end&quot;, float &quot;fps&quot;, bool
  &quot;use_DevIL&quot;, bool &quot;info&quot;, string &quot;pixel_type&quot;</var>)<br>
  <code>ImageSource </code>(<var>string &quot;file&quot;, int &quot;start&quot;,
  int &quot;end&quot;, float &quot;fps&quot;, bool
  &quot;use_DevIL&quot;, bool &quot;info&quot;, string &quot;pixel_type&quot;</var>)<br>
  <code>ImageSourceAnim </code>(<var>string &quot;file&quot;, float &quot;fps&quot;, bool &quot;info&quot;, string &quot;pixel_type&quot;</var>)

<p><code>ImageReader</code> is present in <em>v2.52</em>, it replaces WarpEnterprises'
  plugin, with some minor functionality changes. As of <em>v2.55</em>
  <code>ImageSource</code> is equivalent, with some minor functionality changes.
<code>ImageSource</code> is faster than <code>ImageReader</code> when importing one picture.

<p><var>file</var>: template for the image file(s), where frame number
  substitution can be specified using
  <cite><a href="http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/">sprintf syntax</a></cite>.
  For example, the files written by <code><a href="imagewriter.htm">ImageWriter</a></code>'s
  default parameters can be referenced with <tt>"c:\%06d.ebmp"</tt>. As of v2.56 if the
  template points to a single file then that file is read once and subsequently
  returned for all requested frames.

<p><var>start</var> = 0, <var> end</var> = 1000: Specifies the starting and ending 
  numbers used for filename generation. The file corresponding to <var>start</var>
  is always frame 0 in the clip, the file corresponding to <var>end</var> is
  frame (end-start). The resulting clip has (end-start+1) frames. '<i>end</i>=0' does
  NOT mean 'no upper bound' as with <tt><code><a href="imagewriter.htm">ImageWriter</a></code></tt>.
  The first file in the sequence, i.e., corresponding to 'start', MUST exist in order
  for clip parameters to be computed. Any missing files in the sequence are replaced
  with a blank frame.

<p><var>fps</var> = 24: frames per second of returned clip. An integer value prior to <em>v2.55</em>.

<p><var>use_DevIL</var> = false: When false, an attempt is made to parse (E)BMP files
  with the internal parser, upon failure (prior to v2.56) DevIL processing is invoked.  When true,
  execution skips directly to DevIL processing. You should only need to use this if
  you have BMP files you don't want read by <tt><code>ImageReader</code></tt>'s
  internal parser.

<p><var>info</var> = false: when true, the source filename and DevIL version is
written to each video frame (added in <em>v2.55</em>).

<p><var>pixel_type</var> = &quot;rgb24&quot;: Allow the output pixel format to be specified,
  both rgb24 and rgb32 are supported. The alpha channel is loaded only for rgb32
  and only if DevIL supports it for the loaded image format. (added in <em>v2.56</em>).

<p>The resulting video clip colorspace is RGB if DevIL is used, otherwise it
  is whatever colorspace an EBMP sequence was written from (all AviSynth
  formats are supported).
<p>Supported formats are:</p>
<ul>
  <li>(e)bmp, dds, ebmp, jpg/jpe/jpeg, pal, pcx, png, pbm/pgm/ppm, raw,
    sgi/bw/rgb/rgba, tga, tif/tiff.</li>
  <li>gif, exr, jp2, psd, hdr. [all of them require 1.7.8 DevIL.dll]</li>
</ul>
<p>
  <code>ImageSourceAnim </code> (added in <em>v2.60</em>; requires 1.7.8
DevIL.dll) lets you import
animations (gif, ppm, tiff or psd). If there is a delay between the first and
second image in the animation, the framerate is set accordingly. If this delay
is zero, the framerate is set to 24 fps by default (and can be adjusted by
setting the <i>fps</i> parameter). Note that <i>pixel_type</i> is set to RGB32
by default. If the images in the animation have unequal dimensions, then the
  dimension of the first image is taken and the remaining images are padded with
  black pixels below and or to the right.</p>

<p>1.7.8 DevIL.dll can be downloaded <a href="https://sourceforge.net/projects/openil/files/DevIL%20Win32/1.7.8/DevIL-EndUser-x86-1.7.8.zip" class="external text" title="https://sourceforge.net/projects/openil/files/DevIL%20Win32/1.7.8/DevIL-EndUser-x86-1.7.8.zip" rel="nofollow">here</a>.
Just put the DevIL.dll in your system folder (it will overwrite the 1.6.6
DevIL.dll which comes with AviSynth). Be sure to use the non-unicode version,
because the other one will result in crashes when loading pictures.</p>
<p>DevIL.dll 1.7.8 requires the 2005 VC runtime libraries to be correctly
installed: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&amp;displaylang=en" class="external text" title="http://www.microsoft.com/downloads/details.aspx?familyid=200B2FD9-AE1A-4A14-984D-389C36F85647&amp;displaylang=en" rel="nofollow">Visual
C++ 2005 SP1 Redistributable Package (x86)</a>.</p>

<pre># Default parameters: read a 1000-frame native AviSynth EBMP sequence (at 24 fps)
ImageSource()</pre>
<pre># Read files &quot;100.jpeg&quot; through &quot;199.jpeg&quot; into an NTSC clip
ImageSource(&quot;%d.jpeg&quot;, 100, 199, 29.97)
# Note: floating-point fps available in v2.56</pre>
<pre># Read files &quot;00.bmp&quot; through &quot;50.bmp&quot; bypassing AviSynth's internal BMP reader
ImageSource(&quot;%02d.bmp&quot;, end = 50, use_DevIL = true)</pre>
<pre># Read a single image, repeat 300 times
ImageSource(&quot;static.png&quot;, end = 300, use_DevIL=true)
# Much, much faster in v2.56</pre>
<pre># Read a greyscale (8-bit) jpg:
ImageSource(&quot;GoldPetals-8bit.jpg&quot;, use_DevIL=true)</pre>
<pre># Read a greyscale (8-bit) BMP (using AviSynth's internal BMP reader):
ImageSource(&quot;GoldPetals-8bit.bmp&quot;)</pre>
<pre># Read a YV24 BMP (created with ImageWriter):
ImageSource(&quot;GoldPetals-24bit.ebmp&quot;)</pre>
<pre># Use a still-frame image with audio:
audio = DirectShowSource(&quot;Gina La Piana - Start Over.flv&quot;)
video = ImageSource(&quot;Gina La Piana.jpg&quot;, fps=25, start=1, end=ceil(25*AudioLengthF(audio)/AudioRate(audio)))
return AudioDub(video, audio)</pre>
<pre># Read an animation:
ImageSourceAnim(&quot;F:\TestPics\8bit_animated.gif&quot;)</pre>
<p><b>Notes:</b></p>
<ul>
  <li>&quot;EBMP&quot; is an AviSynth extension of the standard Microsoft RIFF
    image format that allows you to save raw image data (all color formats are
    supported). See <a href="imagewriter" title="ImageWriter">ImageWriter</a>
    for more details.</li>
  <li>Greyscale BMPs are not read and written correctly by DevIL. They should be
    opened using <b>use_DevIL=false</b>.</li>
  <li>DevIL version 1.6.7 as shipped with AviSynth does not correctly support
    DIB/BMP type files that use a pallette, these include 8 bit RGB, Monochrome,
    RLE8 and RLE4. Loading those images requires DevIL version 1.7.8. (Because
    the failure is usually catastrophic, from revision v2.56, internal BMP
    processing does not automatically fail over to DevIL processing. Forcing
    DevIL processing with the shipped DevIL version for these file types is
    currently not recommended.)</li>
</ul>
<p><b>Changes:</b></p>
<table border="1" height="79" width="702">
  <tbody>
    <tr>
      <td height="14" width="35">v2.60</td>
      <td height="14" width="651">Added ImageSourceAnim.</td>
    </tr>
    <tr>
      <td height="33" width="35">v2.60</td>
      <td height="33" width="651">
        <ul>
          <li>Support user upgrade to 1.7.8 DevIL.dll (need to manage CRT
            dependancies).</li>
          <li>Palette and compressed bmp images load correctly now (issue
            894702) [requires 1.7.8 DevIL.dll]</li>
          <li>Support for other formats like: gif, exr, jp2, psd, hdr [requires
            1.7.8 DevIL.dll]</li>
        </ul>
      </td>
    </tr>
    <tr>
      <td height="14" width="35">v2.60</td>
      <td height="14" width="651">Opening greyscale images (as Y8) added; EBMP supports all color
        formats.</td>
    </tr>
  </tbody>
</table>
<p><kbd>$Date: 2012/04/15 14:12:41 $</kbd></p>
<form><input TYPE="Button" VALUE="Back"
onClick="history.go(-1)"></form>
</body>
</html>
